package com.naiterui.ehp.bs.doctor.dao.impl;

import com.naiterui.ehp.bp.domain.NoticeLabel;
import com.naiterui.ehp.bs.doctor.dao.INoticeLabelDao;
import com.naiterui.ehp.bs.doctor.repository.INoticeLabelRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.stream.Collectors;

@Component
public class AdNoticeLabelDaoImpl implements INoticeLabelDao {

    @Autowired
    private INoticeLabelRepository noticeLabelRepository;

    @Override
    public List<Long> getLabelIds(Long noticeId) {
        List<NoticeLabel> list = noticeLabelRepository.findByNoticeId(noticeId);
        return list.stream().map(NoticeLabel::getLabelId).collect(Collectors.toList());
    }
}
